<?php
namespace Home\Controller;
use Think\Controller;

class CommonController extends Controller {
    public function _initialize(){
        //检测登陆
        if (!isset($_SESSION['username']) || $_SESSION['username'] == '') {
            $this->redirect('Login/login');
        }

        //检测其他验证规则 
        $rule = MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME; //大小写无所谓，系统会自动全部转换为小写
        echo $rule;
        $uid = $_SESSION['userid'];
        $res = authcheck($rule,$uid,1,$mode='url');
        if (!$res){
            //$this->redirect('Home/Index/index');
            $this->error('没有权限',U('Login/login'),1);
        }
    }

}


?>
